//该文件用于创建vue的router
import Router from 'vue-router' //引入vue-router
//引入组件
import tribune from '../components/tribune.vue'
import activity from '../components/activity.vue'
import index from '../components/index.vue'
import aboutus from '../components/aboutus.vue'
import log from '../components/log.vue'
import teacherregister from '../components/teacherregister.vue'
import studentregister from '../components/studentregister.vue'
import teacherregister2 from '../components/teacherregister2.vue'
import studentregister2 from '../components/studentregister2.vue'
import register3 from '../components/register3.vue'
import forget from '../components/forget.vue'
import news from '../components/news.vue'
import myhome from '../components/myhome.vue'
import activitydetail from '../components/activitydetail.vue'
import newsdetail from '../components/newsdetail.vue'
import Creatingactivities from '../components/Creatingactivities.vue'
import Creatingnews from '../components/Creatingnews.vue'
import myinformation from '../components/myinformation.vue'
import mycollection from '../components/mycollection.vue'
import myactivities from '../components/myactivities.vue'
import mymessage from '../components/mymessage.vue'
import changeinformation from '../components/changeinformation.vue'
import collectingactivities from '../components/collectingactivities.vue'
import collectionorganization from '../components/collectionorganization.vue'
import alreadyactive from '../components/alreadyactive.vue'
import createdactivities from '../components/createdactivities.vue'
import register0 from '../components/register0.vue'
import inbox from '../components/消息组件/inbox.vue'
import inboxdetail from '../components/消息组件/inboxdetail.vue'
import inboxsimple from '../components/消息组件/inboxsimple.vue'
//创建并暴露一个路由器
const router = new Router({
	mode: 'hash',
	routes: [{
			path: '/tribune',
			component: tribune
		},
		{
			path: '/activity',
			component: activity
		},
		{
			path: '/index',
			component: index
		},
		{
			path: '/aboutus',
			component: aboutus
		},
		{
			path: '/log',
			component: log
		},
		{
			path: '/register0',
			component: register0
		},
		{
			path: '/teacherregister',
			component: teacherregister
		},
		{
			path: '/studentregister',
			component: studentregister
		},
		{
			path: '/forget',
			component: forget
		},
		{
			path: '/teacherregister2',
			component: teacherregister2
		},
		{
			path: '/studentregister2',
			component: studentregister2
		},
		{
			path: '/register3',
			component: register3
		},
		{
			path: '/news',
			component: news
		},
		{
			path: '/myhome',
			component: myhome,
			children: [{
					path: '/myinformation',
					component: myinformation,
					children: [{
							path: '/mymessage',
							component: mymessage
						},
						{
							path: '/changeinformation',
							component: changeinformation
						},
						{
							path: '/inbox',
							component: inbox
						},
						{
							path: '/inboxsimple',
							component: inboxsimple
						},
						{
							path: '/inboxdetail',
							component: inboxdetail
						},
						{
							path: '/',
							redirect: '/mymessage'
						} /*默认跳转路由*/
					]
				},
				{
					path: '/mycollection',
					component: mycollection,
					children: [{
							path: '/collectingactivities',
							component: collectingactivities
						},
						{
							path: '/collectionorganization',
							component: collectionorganization
						},
						{
							path: '/',
							redirect: '/collectingactivities'
						} /*默认跳转路由*/
					]
				},
				{
					path: '/myactivities',
					component: myactivities,
					children: [{
							path: '/createdactivities',
							component: createdactivities
						},
						{
							path: '/alreadyactive',
							component: alreadyactive
						},
						{
							path: '/',
							redirect: '/alreadyactive'
						} /*默认跳转路由*/
					]
				},
				{
					path: '/',
					redirect: '/myinformation'
				} /*默认跳转路由*/
			]
		},
		{
			path: '/activitydetail',
			component: activitydetail
		},
		{
			path: '/newsdetail',
			component: newsdetail
		},
		{
			path: '/Creatingactivities',
			component: Creatingactivities
		},
		{
			path: '/Creatingnews',
			component: Creatingnews
		},
		{
			path: '*',
			redirect: '/index'
		} /*默认跳转路由*/
	],
    scrollBehavior(to,from,saveTop){
      if(saveTop){
        return saveTop;
      }else{
        return {x:0,y:0}
      }
    }

})

export default router

// router.beforeEach((to, from, next) =>{
// 	console.log(to);
// 	console.log(from);
// 	next()
// })